package com.lemo.smart.controller;

import com.lemo.smart.annotation.Controller;
import com.lemo.smart.annotation.Inject;
import com.lemo.smart.annotation.RequestMapping;
import com.lemo.smart.bean.Param;
import com.lemo.smart.bean.Person;
import com.lemo.smart.bean.View;
import com.lemo.smart.helper.ServletHelper;
import com.lemo.smart.service.TestService;

/**
 * Created by 罗选通 on 2017/12/22.
 */
@Controller
public class TestController {

  @Inject
  private TestService testService;

  @RequestMapping("get:/test")
  public View test(Param param) {
    ServletHelper.setRequestAttribute("get", "test");
    Person person = new Person();
    person.setName(String.valueOf(param.getParamMap().get("name")));
    System.out.println(String.valueOf(ServletHelper.getRequestAttribute("get").toString()));
    person.setName(ServletHelper.getRequestAttribute("get"));
    testService.prt();
    return new View("welcome.ftl").addModel("get","name");
  }
}
